package com.dingdang.controller.admin.admin;

import com.dingdang.model.AdminLeftNav;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

/**
 * 后台页面跳转控制类
 */
@Controller
@RequestMapping("/admin/order")
public class OrderViewController {

    // 切换页面
    @RequestMapping("orderIndex")
    public String index(Model model,int index,String openPage) {
        List<AdminLeftNav> allAdminLeftNav2 = new ArrayList<AdminLeftNav>() {{
            add(new AdminLeftNav("加油订单", "orderIndex?index=0&openPage=orderCenterFirst",0));
            add(new AdminLeftNav("油卡充值", "orderIndex?index=1&openPage=fuelList",0));
            add(new AdminLeftNav("拼团订单", "orderIndex?index=2&openPage=pinOrder",0));
            add(new AdminLeftNav("保养订单", "orderIndex?index=3&openPage=baoyangOrder",0));
        }};
        allAdminLeftNav2.get(index).setIsActive(1);
        model.addAttribute("adminLeftNav", allAdminLeftNav2);
        model.addAttribute("isHeadActive", 2);
        model.addAttribute("openPage", openPage);
        return "admin/orderCenter";
    }

    //  交易中心第一个打开的页面
    @RequestMapping("orderCenterFirst")
    public String orderCenterFirst(Model model) {
        return "admin/order";
    }
    //油卡充值
    @RequestMapping("fuelList")
    public String fuelList(Model model) {
        return "admin/fuelList";
    }
    //拼团订单
    @RequestMapping("pinOrder")
    public String pinOrder() {
        return "admin/pinOrder";
    }
    //保养订单
    @RequestMapping("baoyangOrder")
    public String baoyangOrder() {
        return "admin/baoyangOrder";
    }


}
